*********************************************
*	Author: Rithika Kumar	                *
*   GOAL: Other Fixed Effects Specifications*
*   Table A8 (Appendix D)                   * 
*********************************************

* Set working directory to "JOP Replication files" folder on your computer 
* Note that dec_hh_did* pol_did* regressions make the top panel tables for 
* Bargaining-power and Politial engagement
* mob_did* cash_did* own_ac_did* regression outpus make up the bottom panel of* Table A8 on mobility, access to cash and personal banka ccount

use "DATA FILES TO SHARE/main_ew_hh_df.dta", clear


replace EW_health = . if EW_health<0
  
replace EW_child = . if EW_child<0
replace EW_edu = . if EW_edu<0
replace EW_Age = . if EW_Age<0

 
rename mob_score_norm mob
rename dec_score_norm dec_hh
rename pol_score_norm pol
rename GR_hh_cash cash
rename GR_hh_acname own_ac
est clear


 foreach i in mob cash own_ac dec_hh pol {
 quietly reghdfe `i' mig_husb if year == 0, 
eststo `i'_w1
 }
 

foreach i in mob cash own_ac dec_hh pol {
 quietly reghdfe `i' mig_husb if year == 1, 
eststo `i'_w2
 }

 


foreach i in mob cash own_ac dec_hh pol {
quietly reghdfe `i' w2_abshusband_dummy##i.year if did_sample == 1, absorb(STATEID)  vce(cluster vill_id_num)
eststo `i'_did_state
 }


foreach i in mob cash own_ac dec_hh pol {
quietly reghdfe `i' w2_abshusband_dummy##i.year if did_sample == 1, absorb(DISTID)  vce(cluster vill_id_num)
eststo `i'_did_dist
 }



foreach i in mob cash own_ac dec_hh pol {
quietly reghdfe `i' w2_abshusband_dummy##i.year if did_sample == 1, absorb(vill_id_num)  vce(cluster vill_id_num)
eststo `i'_did_vill
 }
 
 * Export TOP Panel of Table A8

 estout dec_hh_did* pol_did* ///
  using "OUTPUT/TABLES/Table_A8_bargpol.tex", replace ///
    prehead("\begin{table}[H]" "\small" "\centering"  ///
            "\begin{tabular}{lcccccc}" "\toprule" ///
            "& \multicolumn{3}{c}{\textbf{Bargaining Power}} & \multicolumn{3}{c}{\textbf{Political Engagement}}\\" ///
            "&(1)&(2) & (3) & (4) &(5)&(6)\\" "\hline" "\hline") ///
    posthead("") keep(1.w2_abshusband_dummy 1.year 1.w2_abshusband_dummy#1.year ) varlabels(mig_husb "Migrant Husband" 1.w2_abshusband_dummy "Migrant Husband"  1.year "Wave 2" 1.w2_abshusband_dummy#1.year  "Migrant Husband  $\times$ Wave 2") ///
	stats(r2_a N, fmt(%9.4f %9.0f) labels("Adj.R2" "Observations")) cells(b(fmt(a2) star) se(par fmt(a2))) starlevels(* 0.10 ** 0.05 *** 0.01) style(tex) collabels(, none) mlabels(, none) ///
    prefoot("\midrule Fixed Effects & State & District & Village& State & District & Village \\" " \midrule")   nonumber ///
     postfoot( "\bottomrule" "\end{tabular}" "\label{tab:other_FE_tab3}" "\begin{tablenotes}" "\end{tablenotes}" "\end{table}")
 

  
  * Export Bottom Panel of Table A8 
  
  estout mob_did* cash_did* own_ac_did* ///
  using "OUTPUT/TABLES/Table_A8_mobfin.tex", replace ///
    prehead("\begin{table}[H]" "\small" "\centering"  ///
            "\begin{tabular}{lccccccccc}" "\toprule" ///
            "& \multicolumn{3}{c}{\textbf{Mobility}} & \multicolumn{3}{c}{\textbf{Access to cash}}&\multicolumn{3}{c}{\textbf{Personal bank a/c}}\\" ///
            "&(1)&(2) & (3) & (4) &(5)&(6)& (7) &(8)&(9)\\" "\hline" "\hline") ///
    posthead("") keep(1.w2_abshusband_dummy 1.year 1.w2_abshusband_dummy#1.year ) varlabels(mig_husb "Migrant Husband" 1.w2_abshusband_dummy "Migrant Husband"  1.year "Wave 2" 1.w2_abshusband_dummy#1.year  "Migrant Husband  $\times$ Wave 2") ///
	stats(r2_a N, fmt(%9.4f %9.0f) labels("Adj.R2" "Observations")) cells(b(fmt(a2) star) se(par fmt(a2))) starlevels(* 0.10 ** 0.05 *** 0.01) style(tex) collabels(, none) mlabels(, none) ///
    prefoot(" Fixed Effects & State & District & Village& State & District & Village& State & District & Village \\" " \midrule")   nonumber ///
     postfoot( "\bottomrule" "\end{tabular}" "\label{tab:other_FE_tab4}" "\begin{tablenotes}" "\noindent Notes: Results using different DID specifications using state, district and village level fixed effects for variables used in Table 3 and 4." "\end{tablenotes}" "\end{table}")

  
  
  
  

